class Student:

    def __init__(self, xm, gender):
        self.name=xm
        self.__gender = gender

    @property
    def gender(self):
        return self.__gender

    @gender.setter
    def gender(self,value):
        self.__gender=value

stu = Student('chl','m')
print(stu.gender)
stu.gender='f'
print(stu.gender)